<?php echo $this->Html->css("prettyPhoto") ;?>
<?php echo $this->Html->script("jquery.prettyPhoto_s") ;?>
<script type="text/javascript">
	$(document).ready(function(){
		$("a[rel^='prettyPhoto']").prettyPhoto();
	});
</script>
<div class="main-content">
      <div class="left-panel"></div>
      <div class="panel">
        <?php echo $this->element("backend/left_menu");?> 
        <div class="content">
          <div class="title">
             <h2 class="t1">Quản lý loại sản phẩm</h2>
          </div>
             <?php echo $this->session->flash(); ?>
            <form  action="<?php echo $this->Html->url("/TypeProducts/admin_index"); ?>" id="table-list-admin-form" method="POST">
                <div class="top_action">
                    <br />
                    <input type="text" value="" class="searh_input" placeholder="  Tìm kiếm" name="search_text"/>
                    <a class="btnsearch" onclick="$('#table-list-admin-form').submit()"><span>Search</span></a>

                    <a href="<?php echo $this->Html->url("/TypeProducts/admin_add"); ?>" class="add"><span>Add</span></a>

                </div> 
                <br />
                <table cellspacing="0" cellpadding="0" class="display" id="table-list-admin">
                    <thead>
                        <tr class="header">
                            <th class="order" width="5%">
                                <a href="#">#</a>
                            </th>
                            <th>
                                <a href="">Loại sản phẩm</a>
                            </th>
                            <th>Actions</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        $i = 1;
                        foreach ($typeProducts as $k => $v) {
                            ?>
                            <tr>
                                <td><?php echo $i++; ?></td>
                                <td>
                                    <?php if(!empty($v['TypeProduct']['parent_id'])){ 
                                        $parent = $this->requestAction("/TypeProducts/getTypeName/".$v['TypeProduct']['parent_id']);
                                    
                                        echo h($parent." --> ".$v['TypeProduct']['type_name']);
                                    } else
                                    {
                                        echo h($v['TypeProduct']['type_name']); 
                                    }?> 
                                </td>
                                <td class="action" nowrap >
                                    <a class="edit" title="Edit" href="<?php echo $this->Html->url("/TypeProducts/admin_edit/" . $v['TypeProduct']['id']); ?>" >Edit</a>
                                    <a class="delete" href="<?php echo $this->Html->url("/TypeProducts/admin_delete/" . $v['TypeProduct']['id']); ?>" title="Delete" onclick="return confirm('Are you sure you want to delete<?php echo $v["TypeProduct"]['type_name'] ?> ');">Delete</a>
                                </td>
                            </tr>
                        <?php } ?>

                    </tbody>
                </table>
            </form>
          <br />
          <div>
                <?php   echo $this->Paginator->prev('',array('tag'=>'a','class' => 'page-far-left','id'=>'prev'),'', array('tag'=>'a','class' => 'page-far-left','id'=>'prev')); ?>
                   <div id="page-info">Page 
                    <strong><?php echo $this->request->params['paging']['TypeProduct']['page'] ?>
                    </strong>/ <?php echo $this->request->params['paging']['TypeProduct']['pageCount'] ?>
                  </div>
                 <?php echo $this->Paginator->next("",array('tag'=>'a','class' => 'page-far-right','id'=>'next'), null, array('tag'=>'a','class' => 'page-far-right','id'=>'next')); ?>
                  
          </div>
         
        </div>
      </div>
      <div class="right-panel"></div>
      <!-- main.end -->
    </div>
    <script>
    $(".page-far-left").click(function(){
        
       window.location.href=document.getElementById('prev').href;
    });
    $(".page-far-right").click(function(){
        
       window.location.href=document.getElementById('next').href;
    });
    </script>